package com.ynwa.maths;

import java.util.UUID;

/**
 * @author gzd
 * @date 2018-10-12 上午 11:38
 * @desc 基于数组的队列
 */
public class ArrayQueue {

    private String[] items;

    private int head = 0;

    private int tail = 0;

    public ArrayQueue(int capacity) {
        if (capacity <= 0)
            throw new IllegalArgumentException("不合适的参数 ...");

        items = new String[capacity];
    }

    public String out() {
        // 入队列时, tail +1 所以相等说明队列为空
        if (head == tail) return null;
        String item = items[head];
        
        return item;
    }

}
